<?php
namespace Wx\Controller;
use Think\Controller;


class MyMsgController extends CommonController {

    // 我的消息
    public function index(){
        // 系统消息
        $voice = M('voice');
        $system_list = $voice->where('u_id ='.session('u_id'))->order('sendtime desc')->select();
        // 互动消息
        $comment_list = M('evaluate_comment')->table(C('DB_PREFIX')."evaluate_comment as c")  //评价-评论详情
                        ->join(C('DB_PREFIX')."member as m ON m.id=c.send_id")
                        ->join(C('DB_PREFIX')."evaluate as e ON e.id=c.e_id")
                        ->field('c.*,m.nickname,m.avatar,e.content as comment')
                        ->where('accept_id = '.session('u_id'))
                        ->order('id desc')
                        ->select();
        //修改状态为已读
        $voice->where('u_id ='.session('u_id'))->setField('status',1);
        M('evaluate_comment')->where('accept_id = '.session('u_id'))->setField('status',1);

        $this->assign('system_list',$system_list);
        $this->assign('comment_list',$comment_list);
        $this->display('voice');
    }//end fun index()

}